$(document).ready(function() {
	var ctx = $("#ctx").val();//获取服务器地址
	$.ajax({
		type : "POST",
		url  : $("#ctx").val()+"/back/main/ap/apmac/top10",
		data : {},
		dataType: "json",
		success : function(data) {
			console.info(data);
			var categoriesForCity = [];
			var wifiSumForCity = [];
			var categoriesForPlace = [];
			var wifiSumForPlace = [];
			for(var i=0;i<data.length;i++){
				if(i==0){
					for(var o in data[i]){
						categoriesForCity.push(o);
						wifiSumForCity.push(data[i][o]);
					}
					console.info(categoriesForCity);
					console.info(wifiSumForCity);
					var chart; 
					 chart = new Highcharts.Chart({  
			                chart: {  
			                    renderTo: 'containerforCity',  
			                    defaultSeriesType: 'column', //图表类型 line, spline, area, areaspline, column, bar, pie , column，scatter  
			                    inverted: false, //左右显示，默认上下正向。假如设置为true，则横纵坐标调换位置  
			                    plotShadow:false,
			                    borderWidth:0.5
			                },  
			                xAxis: {  
			                    categories: categoriesForCity, //X轴的坐标值  
			                    title: { text: '城市'} //Y轴坐标标题  labels:纵柱标尺  
			                },  
			                yAxis: {  
			                    title: { text: '热点数' },  //Y轴坐标标题  labels:纵柱标尺  
			                    min: 0  ,
			                    tickInterval: 10000
			                },  
			                tooltip: {  
			                    formatter: function () {  
			                        //当鼠标悬置数据点时的格式化提示  
			                        return '总热点个数:' + this.y + '<br/>当前城市:' + this.x;  
			                    }  
			                },  
			                credits: {  
			                    enabled: false  
			                },  
			                plotOptions: {  
			                    column: {
			                    	borderColor:"",
			                    	shadow: false,
			                        pointPadding: 0.1,  //图表柱形的  
			                        borderWidth: 0   //图表柱形的粗细 
			                    }, bar: {  
			                        dataLabels: {  
			                            enabled: false  
			                        }  
			                    }  
			                },  
			                legend:{
			                	x:0,
			                	y:5000,
			                	shadow:true
			                },
			                title: { text: '城市热点个数top10' }, //图表主标题  
			                subtitle: { text: '' }, //图表副标题  
			                series: [{ name: '热点个数', data: wifiSumForCity}]  
			            }); 
				}
				else{
					for(var o in data[i]){
						categoriesForPlace.push(o);
						wifiSumForPlace.push(data[i][o]);
					}
					console.info(categoriesForPlace);
					console.info(wifiSumForPlace);
					//
					var chart; 
					 chart = new Highcharts.Chart({  
			                chart: {  
			                    renderTo: 'containerforPlace',  
			                    defaultSeriesType: 'column', //图表类型 line, spline, area, areaspline, column, bar, pie , column，scatter  
			                    inverted: false, //左右显示，默认上下正向。假如设置为true，则横纵坐标调换位置  
			                    borderWidth:0.5
			                },  
			                xAxis: {  
			                    categories: categoriesForPlace, //X轴的坐标值  
			                    title: { text: '系统场景'} //Y轴坐标标题  labels:纵柱标尺  
			                },  
			                yAxis: {  
			                    title: { text: '热点数' },  //Y轴坐标标题  labels:纵柱标尺  
			                    min: 0  ,
			                    tickInterval: 10000
			                },  
			                tooltip: {  
			                    formatter: function () {  
			                        //当鼠标悬置数据点时的格式化提示  
			                        return '总热点个数:' + this.y + '人<br/>当前系统场景:' + this.x;  
			                    }  
			                },  
			                credits: {  
			                    enabled: false  
			                },  
			                plotOptions: {  
			                    column: { 
			                    	borderColor:"",
			                    	shadow: false,
			                        pointPadding: 0.1,  //图表柱形的  
			                        borderWidth: 1    //图表柱形的粗细 
			                    }, bar: {  
			                        dataLabels: {  
			                            enabled: false  
			                        }  
			                    }  
			                },  
			                legend:{
			                	x:0,
			                	y:5000,
			                	shadow:true
			                },
			                title: { text: '系统场景热点个数top10' }, //图表主标题  
			                subtitle: { text: '' }, //图表副标题  
			                series: [{ name: '热点个数', data: wifiSumForPlace}]  
			            }); 
				}
			}
		}
	});
});
